limsSample.detailTopPage = {

    getBtnToolbar: function () {
        let _this = this;
        return {
            type: 'btnToolbar',
            items: [{
                type: 'button',
                text: 'GIKAM.BUTTON.BACK',
                icon: 'back',
                onClick: function () {
                    if (Gikam.isEmpty(_this.param.topPage)) {
                        workspace.window.goBack();
                    } else {
                        Gikam.getLastModal().close();
                    }
                }
            }]
        }
    },

    getBaseInfoTab: function () {
        var _this = this;
        return {
            type: 'tab',
            panels: [{
                title: 'MODULE.BUSINESS.ORDERTASK.TAB.SAMPLE_INFO',
                items: [{
                    type: 'form',
                    id: 'batch-sample-code-detail-top-form',
                    columns: 2,
                    titleWidth: 110,
                    fields: limsBatch.getSampleFormFields(),
                    // autoSave: false,
                    instantSavePath: limsSample.baseUrl + '/instant',
                    service: 'sampleServiceImpl',
                    readonly: _this.param.readonly,
                    url: Gikam.printf(limsSample.batchSampleUrl + '/select/samples/{id}', {
                        id: _this.param.id
                    }),
                    onRendered : function () {
                        this.hideFields(['productNames']);
                        this.toFieldsReadonly(['sampleCode'])
                    }
                },]
            }, {
                title: 'MODULE.BUSINESS.ORDERTASK.TAB.SAMPLE_LOGISTICS_INFO',
                items: [{
                    type: 'form',
                    id: 'sample-logistics-detail-top-form',
                    columns: 2,
                    titleWidth: 100,
                    dbTable: 'T_LIMS_SAMPLE',
                    instantSavePath: limsSample.baseUrl + '/instant',
                    service: 'sampleServiceImpl',
                    fields: limsBatch.getSampleLogisticsFormFields(),
                    readonly: _this.param.readonly,
                    url: Gikam.printf(limsSample.batchSampleUrl + '/select/samples/{id}', {
                        id: _this.param.id
                    })
                },]
            }, {
                title: 'GIKAM.FILE.ATTACHMENT',
                items: [{
                    type: 'uploader',
                    id: 'lims-batch-special-uploader',
                    dbTable: 'T_LIMS_SAMPLE',
                    readonly: true,
                    bizId: Gikam.isEmpty(_this.param.id) ? '-1' : _this.param.id,
                }]
            }]
        }
    },

    createPage: function () {
        Gikam.create('layout', {
            center: {
                items: [this.getBtnToolbar(), this.getBaseInfoTab()]
            },
            toolbarAlign: 'right',
            renderTo: Gikam.isEmpty(this.param.topPage) ? workspace.window.$dom : Gikam.getLastModal().window.$dom
        });
        return this;
    },

    init: function (param) {
        this.param = param;
        this.createPage();
    }
}
